import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Gao zhao xu
 * Date: 2023-10-23
 * Time: 9:52
 */
public class Test2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNext()) {
            String s1 = in.next();
            String s2 = in.next();
            char[] s = s1.toCharArray();
            int max = 0;
            char a = s[max];
            String s3 = "";
            for (int i = 1; i < s.length; i++) {
                if (s[i] > a){
                    a = s[i];
                    max = i;
                }
            }
            for (int i = 0; i <= max; i++){
                s3 += String.valueOf(s[i]);
            }
            s3 += s2;
            for (int i = max + 1; i < s1.length(); i++){
                s3 += String.valueOf(s[i]);
            }
            System.out.println(s3);
        }
    }
}
